package duoqiao;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class A3 {
    public static void main(String[] args) throws IOException {
        /*
        WriteString
        将字符串写入文件中 FileOutputStream
        1创建文件输出流
        2字符转字节 line.getbytes()
        3关闭流
         */
        //覆盖模式
//        FileOutputStream fos = new FileOutputStream("ko.txt");
//        String line = "我在城都的街头走一走";
//        byte[] data = line.getBytes(StandardCharsets.UTF_8);//字符转字节
//        fos.write(data);
//
//        line = "你笑的像一朵花";
//        data = line.getBytes(StandardCharsets.UTF_8);//重新赋值
//        fos.write(data);
//
//        System.out.println("写出完毕");
//        fos.close();

//        FileOutputStream fos1 = new FileOutputStream("ll.dat",true);
//        String line1 = "城南的花开了";
//        byte[] data1 = line1.getBytes(StandardCharsets.UTF_8);//字符转字节
//        fos1.write(data1);
//        System.out.println("写完");
//        fos1.close();
    }
}
class ArrarStack<E>{
    private Object[] arr = new Object[10];
    private int size = 0;

    public void push(E e){
        if (size <= arr.length){
            //定义新数组
            Object[] newArr = new Object[arr.length*2];
            System.arraycopy(arr,0,newArr,0,size);
        }
    }
}
